import { createStore } from 'redux'
// 初始值
const initState = {
  count: 1
}

// 处理函数
const reducer = (state = initState, action) => {
  switch(action.type) {
    case 'add': 
      return {
        ...state,
        count: state.count + 1
      };;
    default: 
      return state
  }

}

// 创建仓库
const store = createStore(reducer)
// 获取数据
console.log(store.getState());
// 提交载荷
store.dispatch({ type: 'add' })
console.log(store.getState());